import { defineConfig } from 'vite';
import vue from '@vitejs/plugin-vue';
import VueSetupExtend from 'vite-plugin-vue-setup-extend';
export default defineConfig({
	base: './',
	plugins: [
		vue(),
		VueSetupExtend()
	],
	optimizeDeps: {
		include: ['schart.js']
	},
	resolve: {
		alias: {
			'@': '/src',
			'~': '/src/assets',
		}
	},
	define: {
		__VUE_PROD_HYDRATION_MISMATCH_DETAILS__: "true",
	},
	build: {
		// 禁用代码压缩
		minify: false,
		// 启用 source map 便于调试
		sourcemap: true
	},
	server: {
        port: 8081, // 设置前端端口号为 6666
        proxy: {
            '/api': {
                target: 'http://127.0.0.1:8080',//本地
                // target: 'https://www.hyq.autos/',//测试环境
                // target: 'http://8.130.134.231:8080',//测试环境
                changeOrigin: true,
                rewrite: (path) => path.replace(/^\/api/, '') // 重写路径，去掉 /api 前缀
            }
        }
    }
});
